package com.centaur0.io;

import java.io.IOException;

import javax.servlet.ServletOutputStream;

public class ServletOutputStreamImpl extends ServletOutputStream{
	private StringBuffer buffer = new StringBuffer();
	
	@Override
	public void write(int b) throws IOException {
		this.buffer.append(b);
	}
	
	@Override
	public void write(byte[] b) throws IOException {
		write(b, 0, b.length);
	}
	
	@Override
	public void write(byte[] b, int off, int len) throws IOException {
		buffer.append(new String(b, off, len));
	}
	
	@Override
	public void print(char c) throws IOException {
		buffer.append(c);
	}
	
	@Override
	public void print(String s) throws IOException {
		buffer.append(s);
	}
	
	@Override
	public void print(int i) throws IOException {
		this.write(i);
	}

	@Override
	public String toString() {
		return buffer.toString();
	}
}